﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SaCoderZ___POS___WPF
{
    /// <summary>
    /// Interaction logic for frmSetup.xaml
    /// </summary>
    public partial class frmSetup : Window
    {
        public frmSetup()
        {
            InitializeComponent();

            ClearTextBoxes();
        }


        private void btnSave_Click(object sender, RoutedEventArgs e)
        {

        }

        private void btnClear_Click(object sender, RoutedEventArgs e)
        {
            ClearTextBoxes();
        }

        private void ClearTextBoxes()
        {
            foreach (var x in LogicalTreeHelper.GetChildren(Grid1))
            {
                if (x is TextBox)
                    ((TextBox)x).Text = null;
            }
            txtProductCode.Focus();
        }

        private void txtProductCode_GotFocus(object sender, RoutedEventArgs e)
        {

            txtProductCode.Background = Brushes.Blue; 
        }

        private void txtProductCode_LostFocus(object sender, RoutedEventArgs e)
        {

            txtProductCode.Background = Brushes.White;
        }

        private void txtName_GotFocus(object sender, RoutedEventArgs e)
        {
            txtName.Background = Brushes.Blue;
        }

        private void txtName_LostFocus(object sender, RoutedEventArgs e)
        {
            txtName.Background = Brushes.White;
        }

        private void txtDescription_GotFocus(object sender, RoutedEventArgs e)
        {
            txtDescription.Background = Brushes.Blue;
        }

        private void txtDescription_LostFocus(object sender, RoutedEventArgs e)
        {
            txtDescription.Background = Brushes.White;
        }

        private void txtBarCode_GotFocus(object sender, RoutedEventArgs e)
        {
            txtBarCode.Background = Brushes.Blue;
        }

        private void txtBarCode_LostFocus(object sender, RoutedEventArgs e)
        {
            txtBarCode.Background = Brushes.White;
        }

        private void txtMake_GotFocus(object sender, RoutedEventArgs e)
        {
            txtMake.Background = Brushes.Blue;
        }

        private void txtMake_LostFocus(object sender, RoutedEventArgs e)
        {
            txtMake.Background = Brushes.White;
        }

        private void txtModel_GotFocus(object sender, RoutedEventArgs e)
        {
            txtModel.Background = Brushes.Blue;
        }

        private void txtModel_LostFocus(object sender, RoutedEventArgs e)
        {
            txtModel.Background = Brushes.White;
        }

        private void txtSupplierCode_GotFocus(object sender, RoutedEventArgs e)
        {
            txtSupplierCode.Background = Brushes.Blue;
        }

        private void txtSupplierCode_LostFocus(object sender, RoutedEventArgs e)
        {
            txtSupplierCode.Background = Brushes.White;
        }

        private void txtSerialNo_GotFocus(object sender, RoutedEventArgs e)
        {
            txtSerialNo.Background = Brushes.Blue;
        }

        private void txtSerialNo_LostFocus(object sender, RoutedEventArgs e)
        {
            txtSerialNo.Background = Brushes.White;
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            frmOptions frmOptions = new frmOptions();
            frmOptions.Show();
            
        }
   
    }
}

